package com.yunlc.kubernetes.traefik.models;

import com.google.gson.annotations.SerializedName;
import io.swagger.annotations.ApiModelProperty;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

public class TraefikV1alpha1IngressRoute {

    @SerializedName("kind")
    private String kind = null;

    @SerializedName("match")
    private String match = null;

    @SerializedName("priority")
    private Integer priority = null;

    @SerializedName("middlewares")
    private List<String> middlewares = null;

    @SerializedName("services")
    private List<TraefikV1alpha1IngressRouteService> services = null;

    @SerializedName("tls")
    private Map<String, Object> tls = null;

    public TraefikV1alpha1IngressRoute kind(String kind) {
        this.kind = kind;
        return this;
    }

    @ApiModelProperty(value = "kind")
    public String getKind() {
        return kind;
    }

    public void setKind(String kind) {
        this.kind = kind;
    }

    public TraefikV1alpha1IngressRoute match(String match) {
        this.match = match;
        return this;
    }

    @ApiModelProperty(value = "match")
    public String getMatch() {
        return match;
    }

    public void setMatch(String match) {
        this.match = match;
    }

    public TraefikV1alpha1IngressRoute priority(Integer priority) {
        this.priority = priority;
        return this;
    }

    @ApiModelProperty(value = "priority")
    public Integer getPriority() {
        return priority;
    }

    public void setPriority(Integer priority) {
        this.priority = priority;
    }

    public TraefikV1alpha1IngressRoute middlewares(List<String> middlewares) {
        this.middlewares = middlewares;
        return this;
    }

    public TraefikV1alpha1IngressRoute addMiddlewareItem(String middlewareItem) {
        if (this.middlewares == null) {
            this.middlewares = new ArrayList<String>();
        }
        this.middlewares.add(middlewareItem);
        return this;
    }

    @ApiModelProperty(value = "middlewares")
    public List<String> getMiddlewares() {
        return middlewares;
    }

    public void setMiddlewares(List<String> middlewares) {
        this.middlewares = middlewares;
    }

    public TraefikV1alpha1IngressRoute services(List<TraefikV1alpha1IngressRouteService> services) {
        this.services = services;
        return this;
    }

    public TraefikV1alpha1IngressRoute addServiceItem(TraefikV1alpha1IngressRouteService serviceItem) {
        if (this.services == null) {
            this.services = new ArrayList<TraefikV1alpha1IngressRouteService>();
        }
        this.services.add(serviceItem);
        return this;
    }

    @ApiModelProperty(value = "services")
    public List<TraefikV1alpha1IngressRouteService> getServices() {
        return services;
    }

    public void setServices(List<TraefikV1alpha1IngressRouteService> services) {
        this.services = services;
    }

    @ApiModelProperty(value = "tls")
    public Map<String, Object> getTls() {
        return tls;
    }

    public void setTls(Map<String, Object> tls) {
        this.tls = tls;
    }

    public TraefikV1alpha1IngressRoute tls(Map<String, Object> tls) {
        this.tls = tls;
        return this;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TraefikV1alpha1IngressRoute extensionsV1beta1IngressRoute = (TraefikV1alpha1IngressRoute) o;
        return Objects.equals(this.kind, extensionsV1beta1IngressRoute.kind) &&
                Objects.equals(this.match, extensionsV1beta1IngressRoute.match) &&
                Objects.equals(this.priority, extensionsV1beta1IngressRoute.priority) &&
                Objects.equals(this.middlewares, extensionsV1beta1IngressRoute.middlewares) &&
                Objects.equals(this.services, extensionsV1beta1IngressRoute.services);
    }

    @Override
    public int hashCode() {
        return Objects.hash( kind, match, services);
    }


    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class TraefikV1alpha1IngressRoute {\n");

        sb.append("    kind: ").append(toIndentedString(kind)).append("\n");
        sb.append("    match: ").append(toIndentedString(match)).append("\n");
        sb.append("    priority: ").append(toIndentedString(priority)).append("\n");
        sb.append("    middlewares: ").append(toIndentedString(middlewares)).append("\n");
        sb.append("    services: ").append(toIndentedString(services)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }

}
